//hook的方式只能用于toolkit 只能用于函数组件
import { Routes } from "react-router-dom"
import "./App.css"

//引入路由数组文件
import originalArr from "./router/routersArray"
import createRoute from "./router/createroute"
import { useSelector } from "react-redux"
function App() {
  let routersArray =  useSelector((state)=>{
   
    return state.userinfo.userRoute
  })
  console.log(routersArray.concat(originalArr))
  return <>
    <div className="App"> 
    <h1>模拟路由登录权限控制</h1>
    
    <Routes>
      {
        createRoute(routersArray.concat(originalArr))
      }
    </Routes>
    
    </div>
  </>
}

export default App